package com.cloud.system.api.factory;

import com.cloud.common.core.domain.R;
import com.cloud.system.api.RemoteMQService;
import com.cloud.system.api.domain.SysOperLog;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

/**
 * 日志服务降级处理
 * 
 * @author cloud
 */
@Component
public class RemoteMQFallbackFactory implements FallbackFactory<RemoteMQService>
{
    private static final Logger log = LoggerFactory.getLogger(RemoteMQFallbackFactory.class);

    @Override
    public RemoteMQService create(Throwable throwable)
    {
        log.error("消息队列服务调用失败:{}", throwable.getMessage());
        return new RemoteMQService()
        {

            @Override
            public R<Boolean> saveLog(SysOperLog sysOperLog, String source){
                return null;
            }
        };

    }
}
